
#include <common.h>
#include <command.h>
#include "../drivers/net/fh_qos_gmac.h"

//eth.addr == 79:25:af:35:aa:ae
__attribute__((aligned(32))) static const unsigned char tcp_ip_packet[1514] = {
0x79, 0x25, 0xaf, 0x35, 0xaa, 0xae, 0x62, 0xd8, /* x$.5..b. */
0xe9, 0x05, 0xe6, 0x64, 0x08, 0x00, 0x45, 0x00, /* ...d..E. */
0x05, 0xdc, 0x26, 0x67, 0x40, 0x00, 0x40, 0x06, /* ..&g@.@. */
0xa1, 0x93, 0x0a, 0x51, 0x05, 0x7b, 0x0a, 0x51, /* ...Q.{.Q */
0x53, 0x05, 0xb0, 0xce, 0x27, 0x11, 0x64, 0xa5, /* S...'.d. */
0xa8, 0x4d, 0xd1, 0x0d, 0x58, 0x05, 0x80, 0x10, /* .M..X... */
0x1c, 0x84, 0xc0, 0x5f, 0x00, 0x00, 0x01, 0x01, /* ..._.... */
0x08, 0x0a, 0xff, 0xff, 0xad, 0xc1, 0x09, 0x52, /* .......R */
0xbf, 0xa2,/*tcp head done...*/ 
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ..012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, /* 67890123 */
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, /* 45678901 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 23456789 */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */
0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* 89012345 */
0x36, 0x37                                      /* 67 */
};



#define MAX_TSO_SEGMENT_SIZE	0x20000
struct dwcqos_dma_desc  *dwcqos_tso_package_pre_set(struct dw_qos* p, u8 *buff, u32 tcp_hsize, u32 buf_size){
	struct dwcqos_dma_desc  *p_tx_desc;
	u32 payload_desc;
	u32 payload_size;
	u32 payload_add;
	u32 each_desc_xfer_size;
	u32 i;
	u32 queue_no = p->active_queue_index;
	payload_size = buf_size - tcp_hsize;
	//maybe check max size tcp segment is 128KB
	if(payload_size > MAX_TSO_SEGMENT_SIZE)
		return -1;

	p_tx_desc = get_tx_active_desc(p, queue_no); 
	//set head desc...
	//1:desc3 bit[18]
	p_tx_desc->desc3 |= 1<<18;
	//2:pro payload len of tcp/ip -> desc3[17:0] 
	p_tx_desc->desc3 |= payload_size;
	//3:pro head len of tcp/ip -> desc3[22:19]?????maybe 2^5 = 32B tcp headlen??
	p_tx_desc->desc3 |= 5 << 19;
	p_tx_desc->desc2 |= tcp_hsize;
	//head add -> first desc buff 1 field
	p_tx_desc->desc0 |= (u32)buff;
	p_tx_desc->desc3 |= 1 << 29 | 1 << 31;
	flush_dcache_range((u32)p_tx_desc, (u32)p_tx_desc + sizeof(struct dwcqos_dma_desc));


	/*
	total payload
	->desc0_max_xfer0 + desc0_max_xfer1 + desc0_max_xfer2 ..
	
	desc0_max_xfer0 (hw auto cal tcp head...)
	->[tcp head0 + mss data0] + [tcp head1 + mss data1] ... 
	*/
	payload_add = (u32)&buff[tcp_hsize];
	while(payload_size){
		each_desc_xfer_size = min(payload_size, p->tx_queue[queue_no].desc_xfer_max_size);
		payload_size -= each_desc_xfer_size;

		p_tx_desc = get_tx_active_desc(p, queue_no);
		//xfer add..
		p_tx_desc->desc1 |= payload_add + i * p->tx_queue[queue_no].desc_xfer_max_size;
		//xfer size..
		p_tx_desc->desc2 |= each_desc_xfer_size << 16;
		p_tx_desc->desc3 |= 1 << 31;
		flush_dcache_range((u32)p_tx_desc, (u32)p_tx_desc + sizeof(struct dwcqos_dma_desc));
	}
	p_tx_desc->desc3 |= 1 << 28;
	
	return p_tx_desc;
}


int cmd_dwcqos_tso_test(cmd_tbl_t *cmdtp,int flag,int argc,char *argv[]){

	int speed;
	int duplex;
	int loop_size;
	int data;
	char *endp;
	int i;
	struct dw_qos *gmac;
	struct eth_device * p_eth = 0;
	struct dwcqos_dma_desc *p_desc = 0;

	p_eth = eth_get_dev_by_name(eth_get_name());
	if(!p_eth){
		printf("find no eth dev...\n");
		return -1;
	}
	gmac = (struct dw_qos *) p_eth->priv;
	p_desc = dwcqos_tso_package_pre_set(gmac, tcp_ip_packet, 66, sizeof(tcp_ip_packet));
	//debug paload 400B
	dwcqos_dma_chan_set_mss(gmac, gmac->active_queue_index, 400);
	//dwcqos_dma_chan_set_mss(gmac, gmac->active_queue_index, gmac->tx_queue[gmac->active_queue_index].hw_queue_size / 2);
	fh_qos_mac_send_with_desc(p_eth, p_desc);
	printf("tso send done..\n");
}

U_BOOT_CMD(

	cmd_dwcqos_tso_test,6,1,cmd_dwcqos_tso_test,"usage:qos send tcp/ip frame\n",
	"queue_no (abort: ctl + c)\n"

);

